4 * @author willCodeForFood
8 import java.awt.KeyEventDispatcher;
9 import java.awt.KeyboardFocusManager;
10 import java.awt.event.KeyEvent;
11 import java.awt.event.WindowAdapter;
12 import java.awt.event.WindowEvent;
13 import java.rmi.RMISecurityManager;
15 import javax.swing.JButton;
16 import javax.swing.JFrame;
17 import javax.swing.JLabel;
18 import javax.swing.JPanel;
19 import javax.swing.SwingConstants;
20 import javax.swing.UIManager;
23 @SuppressWarnings("deprecation")
24 public class StartWindow extends JFrame {
26 private static final long serialVersionUID = 1L;
28 private JPanel jContentPane = null;
29 private JButton boton2 = null;
30 private JButton boton3 = null;
31 private JLabel lblNewLabel;
33 public static void main(String[] args) {
35 StartWindow a = new StartWindow();
37 System.setProperty("java.security.policy", "java.policy");
43 System.setProperty("java.security.policy", "java.policy");
45 System.setSecurityManager(new RMISecurityManager());
47 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
49 } catch (com.db4o.ext.DatabaseFileLockedException e) {
51 .setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!");
52 a.lblNewLabel.setForeground(Color.RED);
53 System.out.println("Error in StartWindow: " + e.toString());
54 } catch (Exception e) {
55 a.lblNewLabel.setText("Error: " + e.toString());
56 a.lblNewLabel.setForeground(Color.RED);
57 System.out.println("Error in StartWindow: " + e.toString());
63 * This is the default constructor
66 public StartWindow() {
69 addWindowListener(new WindowAdapter() {
71 public void windowClosing(WindowEvent e) {
78 KeyboardFocusManager.getCurrentKeyboardFocusManager()
79 .addKeyEventDispatcher(new KeyEventDispatcher() {
82 public boolean dispatchKeyEvent(KeyEvent e) {
83 switch (e.getKeyCode()) {
85 case KeyEvent.VK_ESCAPE:
93 // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
97 * This method initializes this
101 private void initialize() {
102 // this.setSize(271, 295);
103 this.setSize(495, 290);
104 this.setContentPane(getJContentPane());
105 this.setTitle("Rural Houses");
109 * This method initializes jContentPane
111 * @return javax.swing.JPanel
113 private JPanel getJContentPane() {
114 if (jContentPane == null) {
115 jContentPane = new JPanel();
116 jContentPane.setLayout(null);
117 jContentPane.add(getLblNewLabel());
118 jContentPane.add(getBoton2());
119 jContentPane.add(getBoton3());
125 * This method initializes boton2
127 * @return javax.swing.JButton
129 private JButton getBoton2() {
130 if (boton2 == null) {
131 boton2 = new JButton();
132 boton2.setBounds(0, 74, 479, 93);
133 boton2.setText("Login");
134 boton2.addActionListener(new java.awt.event.ActionListener() {
135 public void actionPerformed(java.awt.event.ActionEvent e) {
136 // C?digo cedido por la universidad
137 JFrame a = new LoginGUI();
146 * This method initializes boton3
148 * @return javax.swing.JButton
150 private JButton getBoton3() {
151 if (boton3 == null) {
152 boton3 = new JButton();
153 boton3.setBounds(0, 165, 479, 87);
154 boton3.setText("Query availability");
155 boton3.addActionListener(new java.awt.event.ActionListener() {
156 public void actionPerformed(java.awt.event.ActionEvent e) {
157 // C?digo cedido por la universidad
158 // JFrame a = new QueryAvailabilityWindow();
159 JFrame a = new QueryAvailabilityGUI2();
168 private JLabel getLblNewLabel() {
169 if (lblNewLabel == null) {
170 lblNewLabel = new JLabel("Select option:");
171 lblNewLabel.setBounds(0, 0, 479, 63);
172 lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
173 lblNewLabel.setForeground(Color.BLACK);
174 lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
179 } // @jve:decl-index=0:visual-constraint="0,0"